// 1.接口用来定义一个对象的类型   interface是接口的意思
// 在定义类型的时候，属性和类型都是固定的
interface  obj1Type{
    name:string,
    age:number
}

const obj1:obj1Type ={
    name:'xiaoxia',
    age:20,
}
    // 2.可选属性
    interface obj2Type{
        name:string,
        age:number,
        sex?:any//可选属性，？代表是判断 any是任何的意思
    }  
    const obj2:obj2Type ={ 
        name:"laowang",
        age:24,
        sex:'nan'//sex属性可能存在也可能不存在
    }

    // 3.对象中有数组
    type obj3ScoreType =number[];

    interface obj3Type{
        name:string,
        age:number,
        scrond:obj3ScoreType
    }
    const obj7:obj3Type ={
        name:"laowen",
        age:20,
        scrond:[70,80,90]
    }
    // 4.对象中有对象
    interface obj4OtherType{
        height:number,
        weight:number,
        guigo:string[]
    }
    interface obdec4{
        name:string,
        age:number,
        other:obj4OtherType
    }
    const obj4:obdec4 ={
        name :"xiaocheng",
        age:20,
        other:{
            height:188,
            weight:130,
            guigo:["qingtian","xiayutian","qifeng"]
        }
    }

    // 只读属性
    interface obj5Type{
        name:string,
        // 只读属性
        readonly age:number
    }

    const obj9:obj5Type={
        name :"laoxuang",
        age:22,
    }

    